/**
 * 
 */
package travibot.ui;

import java.util.Observer;

import travibot.engine.GameSessionFacade;
import travibot.engine.Session;
import travibot.ui.gui.GUIFactory;

/**
 * @author tajzivit
 *
 */
public abstract class UIFactory implements Observer{

    private static UIFactory factory = null;
    private Session session = null;
    private GameSessionFacade gameSession;
    
    
    public static UIFactory getFactory(Session session){

        if(factory == null){
            factory = new GUIFactory();
            
            factory.session = session;
            
            factory.registerObservers();
        }
        
        return factory;
    }
    
    private void registerObservers(){
        
        session.addObserver(factory);
    }
    
    public abstract void startUI();
        
    protected Session getActiveSession(){
        
        return this.session;
    }

    
    public GameSessionFacade getGameSession() {
    
        return gameSession;
    }

    
    public void setGameSession(GameSessionFacade gameSession) {
    
        this.gameSession = gameSession;
    }
    
    
    
    
}
